package Negocio;

import java.util.ArrayList;
import java.util.List;

import DTO.DTO_InformeReposicion;
import DTO.DTO_InformeReposicionArea;
import Entities.Entity_InformeReposicion;
import Entities.Entity_InformeReposicionArea;

public class InformeReposicion {
	
	private int idInformeReposicion;
	private List<InformeReposicionArea> informesRepAreas;
	
	//Constructores
	public InformeReposicion(int idInformeReposicion,
			List<InformeReposicionArea> informesRepAreas) {
		super();
		this.idInformeReposicion = idInformeReposicion;
		this.informesRepAreas = informesRepAreas;
	}
	
	public InformeReposicion(DTO_InformeReposicion i){
		this.idInformeReposicion = i.getIdInformeReposicion();
		this.informesRepAreas = new ArrayList<InformeReposicionArea>();
		for(DTO_InformeReposicionArea a : i.getInformesRepAreas()){
			this.informesRepAreas.add(new InformeReposicionArea(a));
		}
	}
	public InformeReposicion(Entity_InformeReposicion i){
		this.idInformeReposicion = i.getIdInformeReposicion();
		this.informesRepAreas = new ArrayList<InformeReposicionArea>();
		for(Entity_InformeReposicionArea a : i.getInformesRepAreas()){
			this.informesRepAreas.add(new InformeReposicionArea(a));
		}
	}
	public InformeReposicion() {
	}
	
	//GET & SET
	public int getIdInformeReposicion() {
		return idInformeReposicion;
	}
	public void setIdInformeReposicion(int idInformeReposicion) {
		this.idInformeReposicion = idInformeReposicion;
	}
	public List<InformeReposicionArea> getInformesRepAreas() {
		return informesRepAreas;
	}
	public void setInformesRepAreas(List<InformeReposicionArea> informesRepAreas) {
		this.informesRepAreas = informesRepAreas;
	}
	
	
	
	public DTO_InformeReposicion toDTO(){
		DTO_InformeReposicion dto_InformeReposicion = new DTO_InformeReposicion();
		dto_InformeReposicion.setIdInformeReposicion(this.idInformeReposicion);
		List<DTO_InformeReposicionArea> aux = new ArrayList<DTO_InformeReposicionArea>();
		for(InformeReposicionArea a : this.informesRepAreas){
			aux.add(a.toDTO());
		}
		
		dto_InformeReposicion.setInformesRepAreas(aux);
		return dto_InformeReposicion;
	}
	
	
	public Entity_InformeReposicion toEntity(){
		Entity_InformeReposicion i = new Entity_InformeReposicion();
		i.setIdInformeReposicion(this.idInformeReposicion);
		List<Entity_InformeReposicionArea> aux = new ArrayList<Entity_InformeReposicionArea>();
		for(InformeReposicionArea a : this.informesRepAreas){
			aux.add(a.toEntity());
		}
		
		i.setInformesRepAreas(aux);
		return i;
	}
	
	public void addInformeReposicionArea(InformeReposicionArea ira)
	{
		informesRepAreas.add(ira);
	}
	

}
